'use strict';

const BaseService = require('./base');

class FileService extends BaseService {
  constructor(...props) {
    super('File',...props)
  }

  async getFileUPath(id) {
    const {primary_model, ctx} = this
    return await primary_model.findOne({
      where: {id},
      attributes: ['filename', 'upload_path_id'],
      include: {
        model: ctx.model.UploadPath,
        attributes: ['id', 'value']
      }
    })
  }
}

module.exports = FileService;
